package com.lyn.solitude.plugin

import com.android.build.api.instrumentation.FramesComputationMode
import com.android.build.api.instrumentation.InstrumentationScope
import com.android.build.api.variant.AndroidComponentsExtension
import org.gradle.api.Plugin
import org.gradle.api.Project

/**
 * @author longyn 2024/5/12
 * @version 1.0.0
 */
class IPlugin : Plugin<Project>{
    override fun apply(target: Project) {
        FileUtil.buildPath = target.projectDir.absolutePath+"\\src\\main\\java\\"
        val androidComponents = target.extensions.getByType(AndroidComponentsExtension::class.java)
        androidComponents.onVariants { variant ->
            variant.instrumentation.transformClassesWith(
                SetPluginClassNameVisitorFactory::class.java,
                InstrumentationScope.ALL
            ){

            }
            variant.instrumentation.setAsmFramesComputationMode(FramesComputationMode.COPY_FRAMES)

        }
    }
}
